#!/bin/sh

kdc_start() {
  if [ -x /usr/libexec/kdc ]; then
    echo "Starting the kdc service: /usr/libexec/kdc --detach"
    /usr/libexec/kdc --detach
  fi
}

kdc_stop() {
  killall kdc
}

kdc_restart() {
  kdc_stop
  sleep 1
  kdc_start
}

case "$1" in
  'start')
    kdc_start
  ;;
  'stop')
    kdc_stop
  ;;
  'restart')
    kdc_restart
  ;;
  *)
    echo "Usage: $0 start|stop|restart"
  ;;
esac

